package com.company.clientscard.server.service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.company.clientscard.server.entityimport.DocumentLoadTimer;

public class Context {
	// public static final ApplicationContext CONTEXT;

	private static ApplicationContext instance = null;

	// private Context() {
	// instance = new ClassPathXmlApplicationContext(
	// "classpath*:WEB-INF/application-beans.xml");
	// }

	public static ApplicationContext getContext() {
		if (instance == null) {
			instance = new ClassPathXmlApplicationContext(
					"classpath*:WEB-INF/context/application-beans.xml");

			new DocumentLoadTimer(5);
		}
		return instance;
	}

	public <T> T getBean(String bean) {
		return (T) instance.getBean(bean);
	}

}
